﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using A2DFramework.CommandBusService;
using A2DFramework.EventService;
using A2DFramework.InstanceService;

namespace A2DFramework.Infrastructure.Mvc.MvcControllers
{
    public abstract class BaseController : Controller
    {
        private ICommandBus cmdBus=null;

        /// <summary>
        /// 命令总线
        /// </summary>
        protected ICommandBus CommandBus 
        {
            get
            {
                if (cmdBus != null)
                    return this.cmdBus;
                this.cmdBus=ObjectFactory.Resolve<ICommandBus>();
                return this.cmdBus;
            }
        }

        /// <summary>
        /// 事件总线
        /// </summary>
        protected EventBusCoordinator EventBus
        {
            get
            {
                return EventBusCoordinator.Instance();
            }
        }
    }
}
